<template>
  <div>
    <el-button @click="toCom2">
      跳转到组件二
    </el-button>
    <el-button @click="changMyName">
      更改my_name
    </el-button>
  </div>
</template>

<script>
export default {
  name: "MyCompoent1",
  data() {
    return {
      my_name: "组件一"
    };
  },
  methods: {
    toCom2() {
      var params = {
        my_name: this.my_name
      };
      this.$parent.$emit("on_change_com", "MyComponent2", params);
    },
    changMyName() {
      this.my_name = Math.random()
    }
  }
};
</script>

<style scoped>

</style>